﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WebKit;

namespace upload.Forms
{
    public partial class Formweb : Form
    {
        //private WebKitBrowser browser = new WebKitBrowser();

        public Formweb(string url)
        {
            InitializeComponent();
            //string config = ConfigurationManager.AppSettings["url"];
            //Xpcom.Initialize("Firefox64");
            //var geckoWebBrowser = new GeckoWebBrowser { Dock = DockStyle.Fill };
            //Form f = new Form();
            //f.Controls.Add(geckoWebBrowser);
            //geckoWebBrowser.Navigate("www.google.com");



            //GeckoWebBrowser gecko = new GeckoWebBrowser();
            //Xpcom.Initialize("Firefox");
            //gecko.CreateControl();
            ////gecko.NoDefaultContextMenu = true; //禁用右键菜单"http://ie.icoa.cn/"
            //gecko.Dock = DockStyle.Fill;
            //this.Controls.Add(gecko);
            ////gecko.Navigate("https://document-manage-1317383760.cos.ap-shanghai.myqcloud.com/%E5%8C%BB%E9%99%A2%E6%96%87%E4%BB%B6%2F%E4%BF%A1%E6%81%AF%E7%A7%91%2F2023%E5%B9%B42%E6%9C%88%E4%B8%AD%E5%9B%BD%E6%95%B0%E6%8D%AE%E5%BA%93%E8%A1%8C%E4%B8%9A%E5%88%86%E6%9E%90%E6%8A%A5%E5%91%8A-%E5%A4%9A%E6%A8%A1%E5%B9%B6%E8%B5%B7%EF%BC%8C%E4%B8%87%E5%90%91%E8%9E%8D%E5%90%88.pdf?ci-process=doc-preview&sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDr-tlRHxcYkNt13AzwCEHOQcaaOlR3BhwROo4Snx6UBxOaFFQp2BhQ_HqY-zVETWF%26q-sign-time%3D1682563280%3B1682566880%26q-key-time%3D1682563280%3B1682566880%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3Dbddc11d0e30eacc1c1ca391bcec903f83153bc32%26x-cos-security-token%3DxgSJeNmeZdSacJlQlhqzs1L68zddAaJae9eb08ae71b3de346f15b93bce4649c69M6yLDwN9N8hl8Pbl2T0CeJ60kc-4dU5XWU8BUOxaiHKoDFWE_M2klUW_wguSIFSFLiIZ3dD3u6hBTFO3f1Z_mnL5Um2ilyAVVwaW_XlQDpmGoi_XFl32BqQ0rXIzB6INRBU-EEExzDlV-sp6KXXbnajPhm0z8v5Hgo9HQ-SZYYaJtuH4_0nPhqKkvgxpoTT&dstType=html");
            //gecko.Navigate("http://ie.icoa.cn/");

            //ChromiumWebBrowser webview = new ChromiumWebBrowser(url);
            //webview.Dock = DockStyle.Fill;
            //this.Controls.Add(webview);
            //browser.Dock = DockStyle.Fill;
            //browser.NewWindowRequest += new NewWindowRequestEventHandler(browser_NewWindowRequest);
            //browser.NewWindowCreated += new NewWindowCreatedEventHandler(browser_NewWindowCreated);
            //https://document-manage-1317383760.cos.ap-shanghai.myqcloud.com/test.pptx?ci-process=doc-preview&dstType=html&copyable=0&htmlwaterword=dGVzdAog&htmlParams=eyJtb2RlIjoibm9ybWFsIiwiY29tbW9uT3B0aW9ucyI6eyJpc1Nob3dIZWFkZXIiOmZhbHNlLCJpc1Nob3dUb3BBcmVhIjp0cnVlfSwicHB0T3B0aW9ucyI6eyJpc1NsaWRlc1N0YXR1c1BsYXkiOiB0cnVlfX0=
            //browser.DocumentCompleted+=new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);
            //this.Controls.Add(browser);
            //browser.IsWebBrowserContextMenuEnabled = false;
            //browser.ContextMenuStrip = contextMenu;
            //browser.Navigate("https://document-manage-1317383760.cos.ap-shanghai.myqcloud.com//医院文件/黄昱明-广东医科大学15625874605.pdf");
            //WebKitBrowser webkit = new WebKitBrowser();
            //webkit.Dock = DockStyle.Fill;
            //webkit.Navigate("https://document-manage-1317383760.cos.ap-shanghai.myqcloud.com//医院文件/黄昱明-广东医科大学15625874605.pdf");
            //this.Controls.Add(webkit);

        }

        void browser_NewWindowCreated(object sender, NewWindowCreatedEventArgs e)
        {
            //e.WebKitBrowser.Navigating += new WebBrowserNavigatingEventHandler(WebKitBrowser_Navigating);
            //this.Controls.Add(e.WebKitBrowser);
        }
        //void WebKitBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        //{
        //    WebKitBrowser subBrowser = (WebKitBrowser)sender;
        //    subBrowser.Stop();
        //    subBrowser.Dispose();
        //    this.Controls.Remove(subBrowser);
        //    //browser.Navigate(e.Url.ToString());
        //}
    }
}
